#ifndef _SMART_DEVICE_NET_PROTOCOL_HEAD_H
#define _SMART_DEVICE_NET_PROTOCOL_HEAD_H
#include <iostream>
#include <istream>
#include <string>
#include <json/json.h>

using namespace std;

class SmartDevicenetProtocol
{
public:
	void                          addOperation(const string &operation);
	void                          addCommand(const string &command);
	void                          addDeviceType(const string &type);
	void                          addDeivceNumber(const string &number);
	void                          addDevice(const string &type, const string &number);
	void                          addListItem(const string &operation, const string &type, const string &number);
	void                          addErrmsg(const string &errmsg = "");
	void                          addResult(const string &errmsg = "", const string &data = "");
	void                          addListResult(const string &errmsg);
	string                        toString();
	string                        getOperation(void) const;
	string                        getCommand(void) const;
	string                        getDeviceValue(const string &key);
	uint32_t                      getDeviceType(void) const;
	uint32_t                      getDeviceNumber(void) const;
	uint32_t                      getUserId(void) const;
	bool                          empty(void);
	static SmartDevicenetProtocol fromJsonData(const string &jsonData);

private:
	Json::Value root;
	Json::Value objArray;
};

#endif